<#import "body.ftl" as com>
<@com.body title='评论管理 - Miniblog4j' comment='active'>
<link rel="stylesheet" type="text/css" href="/static/css/ke-miniblog4j.css">
<#if post??>
	<div class="in">
		<span style="float: right;"><a href="#" onclick="editComment(${post.id}, 0, 0)">快速评论</a></span>
		<h2><a href="/admin/post?oper=edit&id=${post.id}" title="编辑 - ${post.title}">${post.title}</a> - 评论</h2>
	</div>
	<div class="line"></div>
</#if>
<div class="in">
	<#if comments?has_content>
		<table border="0" cellspacing="0" cellpadding="10" class="table_main">
		  <tbody><tr style="background-color:#d9d8d8; font-size:14px;">
			<td style="padding: 14px;" width="200"><strong>作者</strong></td>
			<td style="padding: 14px;"><strong>评论</strong></td>
			<td style="padding: 14px;" width="80"><strong>文章</strong></td>
		  </tr>
		  <#list comments as c>
			  <tr class="<#if c_index%2==0>gray</#if>">
				<td>${c.authorName!}</td>
				<td>
					${c.content}
					<div class="actions_wrapper">
					<div class="actions" style="display: none;">
						<a href="#" onclick="editComment(${c.postId}, ${c.id}, ${c.parentId})">修改</a> |
						<a href="#" onclick="editComment(${c.postId}, 0, ${c.id})">回复</a> |
						<a href="/admin/comment?oper=delete&postId=${postId!''}&id=${c.id}">删除</a>
					</div></div>
				</td>
				<td><a href="/post?id=${c.postId}">查看文章</a></td>
			  </tr>
		  </#list>
		</tbody></table>
	<#else>
  		<h2>还没人评论<#if post??>此文章</#if></h2>
	</#if>
</div>
<#include "comment-pagebar.ftl">

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<link rel="stylesheet" type="text/css" href="/static/lib/fancybox//jquery.fancybox.css" />
<script type="text/javascript" src="/static/lib/fancybox/jquery.fancybox.pack.js"></script>

<script type="text/javascript">
// 打开编辑框, 文章id, 评论id, 父评论id
function editComment(postId, id, parentId) {
	$.fancybox.open({
		href: "/admin/comment?oper=edit&postId=" + postId + "&id=" + id + "&parentId=" + parentId,
		type: "iframe",
		padding: 5,
		width: 652,
		height: 450,
		autoSize: false,
		scrolling: "no",
		helpers: {
			overlay: {
				closeClick: false
			}
		}
	});
}
$("tr").mouseover(function(){
		$(this).find(".actions").show();
}).mouseout(function(){
	$(this).find(".actions").hide();
});
</script>

</@com.body>